package com.example.springstudy.aopDev;

import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

/**
 * @Auther ZhaoJunZhou
 * @Date 2020/9/23
 */
@Aspect
@Component
public class AopTest {
    //不是必须的而且这当中的方法不会执行，感觉就是为了统一配置防止写错
    @Pointcut("execution(* com.example.springstudy.controller.AopTestControlller.test())")
    public void point() {
        System.out.println("这个是切点");
    }
    @Before("point()")
    public void beFore2() {
        System.out.println("before 2");
    }
    @After("point()")
    public void after2() {
        System.out.println("after2 2");
    }
    @Before("execution(* com.example.springstudy.controller.AopTestControlller.test())")
    public void beFore() {
        System.out.println("before 1");
    }
    @After("execution(* com.example.springstudy.controller.AopTestControlller.test())")
    public void after() {
        System.out.println("after 1");
    }
}
